#ifndef GameRender_h__
#define GameRender_h__
#include "Scheduler/ITask.h"
#include "Render/Animate/Animate.h"
#include <list>
#include "Message/ICallback.h"
#include "Message/Message.h"
#include "Logic/Vector2D.h"

class RenderMessage
{
public:
	int         m_type;
	int         m_time;

	Vector2Di   m_cell1;
	Vector2Di   m_cell2;
	int         m_data3;
	void*       m_pExtra;
public:
	RenderMessage(int type)
	{
		m_type = type;
		m_time = 0;
		m_pExtra = NULL;
	}
};


class EntityMoveCallback : public ICallback   
{
	void function(void* parent, Message* msg);
};

class EntityStopCallback : public ICallback   
{
	void function(void* parent, Message* msg);
};

class EntityHurtCallback : public ICallback
{
	void function(void* parent, Message* msg);
};

class EntityAttackCallback : public ICallback
{
	void function(void* parent, Message* msg);
};


typedef std::list<RenderMessage* > RenderMessageList;
typedef std::list<Animate*> AnimateTest;

class GameRender
{
public:
	AnimateTest m_aniList;        //just for testing, should be removed later.
	GameRender(Animate* ani,Animate* ani2);
	void Update(int elapsed);
	void ShowCell();

	void AddRenderMessage(RenderMessage* pMsg);
	void HandleEntityMove(const LogicMsg& data);
protected:
	int m_lastTime;
	RenderMessageList m_renderMsgList;
	EntityMoveCallback m_entityMoveCallback;
	EntityStopCallback m_entityStopCallback;
	EntityHurtCallback m_entityHurtCallback;
	EntityAttackCallback m_entityAttackCallback;
};
#endif // GameRender_h__